package com.baoyi.adapter;

import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.baoyi.doamin.Comments;
import com.baoyi.doamin.WorkItem;
import com.baoyi.service.CommentsServiceImpl;

public class CommentsAdapter extends BaseAdapter {

	private List<TextView> textViews;

	public CommentsAdapter(Context context, Integer id) {
		CommentsServiceImpl service = new CommentsServiceImpl();
		List<Comments> ls = service.findbypid(12);
		textViews = new ArrayList<TextView>();
		if (null != ls) {
			for (Comments workItem : ls) {
				TextView item = new TextView(context);
				item.setText(workItem.getContents());
				textViews.add(item);
			}
		}
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return textViews.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		return textViews.get(position);
	}

}
